<template>
    <el-card class="goods-container">
        <div class="card-container">
            <el-image class="food-cover" :src="data.cover"></el-image>
            <div class="food-info">
                <h3 class="food-name">{{ data.name }}</h3>
                <el-text>{{data.description}}</el-text>
                <p>
                    单价：{{data.price}}
                </p>
            </div>
        </div>
    </el-card>
</template>

<script setup>
defineProps({
    data: {type: Object}
})
</script>

<style scoped>
.goods-container{
    margin: 8px;
    width: 230px;
}
.card-container{
    position: relative;
}
.food-cover{
    width: 100%;
    height: 100%;
}
.food-info{
    text-align: center;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px;
    position: absolute;
    background-color: rgba(98, 98, 98, 0.75);
    color: white;
    transform: translateY(300px);
    transition: 0.5s;
}
.goods-container:hover .food-info{
    transform: translateY(0);
}
.food-name,.food-info :deep(.el-text){
    font-weight: bold;
    color: white;

}
</style>